function [A,b] = read_spmat(fileName)
fid = fopen(fileName, 'r');
%import the matrix
tmp = fscanf(fid,'%d%d',2);
m = tmp(1);
nnz = tmp(2);
I = zeros(nnz,1);
J = zeros(nnz,1);
S1 = zeros(nnz,1);
S2 = zeros(nnz,1);
for i = 1:nnz
    c = fscanf(fid,'%d %d %f %f',4);
    I(i) = c(1)+1;
    J(i) = c(2)+1;
    S1(i) = c(3);
    S2(i) = c(4);
end
b1 = zeros(m,1);
b2 = b1;
for i = 1:m
    c = fscanf(fid,'%f %f',2);
    b1(i) = c(1);
    b2(i) = c(2);
end
S = S1 + 1j*S2;
A = sparse(I,J,S,m,m);
b = b1 + 1j*b2;
